------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  C:\Users\mbeissin\Desktop\Stata files for book\Robustnesstestfiles\Logfiles\robustnesstestschapter6.l
> og
  log type:  text
 opened on:  26 Jan 2022, 13:50:44

. * ============================================================================
. * ROBUSTNESS CHECKS FOR STATISTICAL RESULTS APPEARING IN CHAPTER 6
. * STATA  
. * Robustness checks for results reported in Chapter 6 
. * Author: Mark R. Beissinger  
. * Date:  January 2022  
. * Princeton, NJ 
. * =============================================================================
. * BEFORE RUNNING, YOU MUST SET THE DEFAULT PATH FOR WHERE THE DATA
. *   FILES RESIDE
. * ============================================================================
. * The following datafile is used in these tests:
. *   Data set of urban civic revolt locations--urbancivicspaces.dta
. * =============================================================================
. 
. use urbancivicspaces.dta

. 
. * ==========================================================================
. * PROBABILITY OF OPPOSITION VICTORY IF WITHIN 3/4 KILOMETER OF SEAT OF GOVT
. * ==========================================================================
. * Alternative tests given small sample size
. logit success veryclose lnpartic, or nolog

Logistic regression                             Number of obs     =         54
                                                LR chi2(2)        =      11.67
                                                Prob > chi2       =     0.0029
Log likelihood = -29.757033                     Pseudo R2         =     0.1640

------------------------------------------------------------------------------
     success | Odds Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
   veryclose |   4.529672   3.080137     2.22   0.026     1.194695    17.17419
    lnpartic |   1.916882   .4943577     2.52   0.012     1.156307    3.177734
       _cons |   .0003579   .0011398    -2.49   0.013     6.96e-07    .1840147
------------------------------------------------------------------------------

. firthlogit success veryclose lnpartic, or nolog

                                                Number of obs     =         54
                                                Wald chi2(2)      =       8.68
Penalized log likelihood =  -26.80228           Prob > chi2       =     0.0130

------------------------------------------------------------------------------
     success | Odds Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
   veryclose |   4.077637    2.65281     2.16   0.031     1.139299    14.59417
    lnpartic |   1.817348   .4442589     2.44   0.015     1.125533    2.934393
       _cons |   .0006845   .0020687    -2.41   0.016     1.83e-06    .2558234
------------------------------------------------------------------------------

. regress success veryclose lnpartic

      Source |       SS           df       MS      Number of obs   =        54
-------------+----------------------------------   F(2, 51)        =      6.43
       Model |  2.53584635         2  1.26792318   Prob > F        =    0.0032
    Residual |  10.0567462        51  .197191103   R-squared       =    0.2014
-------------+----------------------------------   Adj R-squared   =    0.1701
       Total |  12.5925926        53  .237596087   Root MSE        =    .44406

------------------------------------------------------------------------------
     success |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
   veryclose |   .2991747   .1227453     2.44   0.018     .0527532    .5455963
    lnpartic |   .1310904   .0460463     2.85   0.006     .0386486    .2235322
       _cons |  -1.099527   .5730855    -1.92   0.061    -2.250044    .0509906
------------------------------------------------------------------------------

. * RESULT: All results remain the same
. 
. * ++++++++++++++++++++++++++++++++++++++++++++++
. * Bootstrapped standard errors with bias correction
. * ++++++++++++++++++++++++++++++++++++++++++++++
. logit success veryclose lnpartic, vce(bootstrap, seed(1234) rep(1000)) or nolog 
(running logit on estimation sample)

Bootstrap replications (1000)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
..................................................    50
..................................................   100
..................................................   150
..................................................   200
..........................x.......................   250
..................................................   300
..................................................   350
............................x.....................   400
..................................................   450
..................................................   500
..................................................   550
..................................................   600
..................................................   650
..................................................   700
..................................................   750
..................................................   800
...............................x..................   850
..................................................   900
..................................................   950
..................................................  1000

Logistic regression                             Number of obs     =         54
                                                Replications      =        997
                                                Wald chi2(2)      =       7.55
                                                Prob > chi2       =     0.0229
Log likelihood = -29.757033                     Pseudo R2         =     0.1640

------------------------------------------------------------------------------
             |   Observed   Bootstrap                         Normal-based
     success | Odds Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
   veryclose |   4.529672   3.219145     2.13   0.034     1.124955    18.23888
    lnpartic |   1.916882   .6593704     1.89   0.059     .9767838     3.76177
       _cons |   .0003579   .0014868    -1.91   0.056     1.04e-07    1.230874
------------------------------------------------------------------------------
Note: One or more parameters could not be estimated in 3 bootstrap replicates;
      standard-error estimates include only complete replications.

. estat bootstrap, all eform

Logistic regression                             Number of obs     =         54
                                                Replications      =        997

------------------------------------------------------------------------------
             |    Observed               Bootstrap
     success |      exp(b)       Bias    Std. Err.  [95% Conf. Interval]
-------------+----------------------------------------------------------------
   veryclose |    4.529672   .6227336   3.2191447    1.124955   18.23888   (N)
             |                                       1.423262   23.97138   (P)
             |                                       1.251198   18.93823  (BC)
    lnpartic |   1.9168819    .128514   .65937038    .9767838    3.76177   (N)
             |                                        1.16891   4.584987   (P)
             |                                        1.10618   3.875456  (BC)
------------------------------------------------------------------------------
(N)    normal confidence interval
(P)    percentile confidence interval
(BC)   bias-corrected confidence interval
Note: One or more parameters could not be estimated in 3 bootstrap replicates;
      standard-error estimates include only complete replications.

. * RESULT: distance variable remains statistically significant, irrespective
. *       of participation levels; participation turn marginally significant
. 
. log close
      name:  <unnamed>
       log:  C:\Users\mbeissin\Desktop\Stata files for book\Robustnesstestfiles\Logfiles\robustnesstestschapter6.l
> og
  log type:  text
 closed on:  26 Jan 2022, 13:51:00
------------------------------------------------------------------------------------------------------------------
